//发布者，依赖收集，通知观察者
class Dep {
  constructor () {
    this.sub = []
  }

  addSub (watcher) {
    this.sub.push(watcher)
  }

  notify () {
    this.sub.forEach(item => {
      item.update && item.update()
    })
  }
}
